Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Displaying Raw • Download


RNS/Cryptography/Provider.py b2188ce9a746a35b770b10bea1b7ccbe93b4e198 (b2188ce9) Text, 2.41 KB

T8b949e# Reticulum License
T8b949e#
T8b949e# Copyright (c) 2016-2025 Mark Qvist
T8b949e#
T8b949e# Permission is hereby granted, free of charge, to any person obtaining a copy
T8b949e# of this software and associated documentation files (the "Software"), to deal
T8b949e# in the Software without restriction, including without limitation the rights
T8b949e# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
T8b949e# copies of the Software, and to permit persons to whom the Software is
T8b949e# furnished to do so, subject to the following conditions:
T8b949e#
T8b949e# - The Software shall not be used in any kind of system which includes amongst
T8b949e# its functions the ability to purposefully do harm to human beings.
T8b949e#
T8b949e# - The Software shall not be used, directly or indirectly, in the creation of
T8b949e# an artificial intelligence, machine learning or language model training
T8b949e# dataset, including but not limited to any use that contributes to the
T8b949e# training or development of such a model or algorithm.
T8b949e#
T8b949e# - The above copyright notice and this permission notice shall be included in
T8b949e# all copies or substantial portions of the Software.
T8b949e#
T8b949e# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
T8b949e# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
T8b949e# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
T8b949e# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
T8b949e# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
T8b949e# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
T8b949e# SOFTWARE.

Tff7b72import T7ee787importlibT7ee787.T7ee787util

Te6edf3PROVIDER_NONE Tff7b72= T79c0ff0x00
Te6edf3PROVIDER_INTERNAL Tff7b72= T79c0ff0x01
Te6edf3PROVIDER_PYCA Tff7b72= T79c0ff0x02

Te6edf3FORCE_INTERNAL Tff7b72= Tff7b72False
Te6edf3PROVIDER Tff7b72= Te6edf3PROVIDER_NONE

Te6edf3pyca_v Tff7b72= Tff7b72None
Te6edf3use_pyca Tff7b72= Tff7b72False

Tff7b72tryTb4b4b4:
Tff7b72if Tff7b72not Te6edf3FORCE_INTERNAL Tff7b72and Te6edf3importlibTff7b72.Td2a8ffutilTff7b72.Td2a8fffind_specTb4b4b4(Ta5d6ff'Ta5d6ffcryptographyTa5d6ff'Tb4b4b4) Tff7b72!= Tff7b72NoneTb4b4b4:
Tff7b72import T7ee787cryptography
Te6edf3pyca_v Tff7b72= Te6edf3cryptographyTff7b72.Td2a8ff__version__
Te6edf3v Tff7b72= Te6edf3pyca_vTff7b72.Td2a8ffsplitTb4b4b4(Ta5d6ff"Ta5d6ff.Ta5d6ff"Tb4b4b4)

Tff7b72if Tffa657intTb4b4b4(Te6edf3vTb4b4b4[T79c0ff0Tb4b4b4]Tb4b4b4) Tff7b72== T79c0ff2Tb4b4b4:
Tff7b72if Tffa657intTb4b4b4(Te6edf3vTb4b4b4[T79c0ff1Tb4b4b4]Tb4b4b4) Tff7b72>Tff7b72= T79c0ff8Tb4b4b4:
Te6edf3use_pyca Tff7b72= Tff7b72True
Tff7b72elif Tffa657intTb4b4b4(Te6edf3vTb4b4b4[T79c0ff0Tb4b4b4]Tb4b4b4) Tff7b72>Tff7b72= T79c0ff3Tb4b4b4:
Te6edf3use_pyca Tff7b72= Tff7b72True

Tff7b72except Tf85149Exception Tff7b72as Te6edf3eTb4b4b4:
Tff7b72pass

Tff7b72if Te6edf3use_pycaTb4b4b4:
Te6edf3PROVIDER Tff7b72= Te6edf3PROVIDER_PYCA
Tff7b72elseTb4b4b4:
Te6edf3PROVIDER Tff7b72= Te6edf3PROVIDER_INTERNAL

Tff7b72def Td2a8ffbackendTb4b4b4(Tb4b4b4)Tb4b4b4:
Tff7b72if Te6edf3PROVIDER Tff7b72== Te6edf3PROVIDER_NONETb4b4b4:
Tff7b72return Ta5d6ff"Ta5d6ffnoneTa5d6ff"
Tff7b72elif Te6edf3PROVIDER Tff7b72== Te6edf3PROVIDER_INTERNALTb4b4b4:
Tff7b72return Ta5d6ff"Ta5d6ffinternalTa5d6ff"
Tff7b72elif Te6edf3PROVIDER Tff7b72== Te6edf3PROVIDER_PYCATb4b4b4:
Tff7b72return Ta5d6ff"Ta5d6ffopenssl, PyCA Ta5d6ff"Tff7b72+Tffa657strTb4b4b4(Te6edf3pyca_vTb4b4b4)


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────